/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package model.impl;

import java.util.Collection;

import model.Actor;
import model.ActorPackActor;
import model.AssociationActorSerie;
import model.ModelPackage;
import model.OtherFilm;
import model.OtherSerie;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Actor</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link model.impl.ActorImpl#getSerieography <em>Serieography</em>}</li>
 *   <li>{@link model.impl.ActorImpl#getFilmography <em>Filmography</em>}</li>
 *   <li>{@link model.impl.ActorImpl#getActorSerie <em>Actor Serie</em>}</li>
 *   <li>{@link model.impl.ActorImpl#getActorPack <em>Actor Pack</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ActorImpl extends EntityProfileImpl implements Actor {
	/**
	 * The cached value of the '{@link #getSerieography() <em>Serieography</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSerieography()
	 * @generated
	 * @ordered
	 */
	protected EList<OtherSerie> serieography;

	/**
	 * The cached value of the '{@link #getFilmography() <em>Filmography</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFilmography()
	 * @generated
	 * @ordered
	 */
	protected EList<OtherFilm> filmography;

	/**
	 * The cached value of the '{@link #getActorSerie() <em>Actor Serie</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getActorSerie()
	 * @generated
	 * @ordered
	 */
	protected EList<AssociationActorSerie> actorSerie;

	/**
	 * The cached value of the '{@link #getActorPack() <em>Actor Pack</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getActorPack()
	 * @generated
	 * @ordered
	 */
	protected ActorPackActor actorPack;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ActorImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.ACTOR;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<OtherSerie> getSerieography() {
		if (serieography == null) {
			serieography = new EObjectContainmentEList<OtherSerie>(OtherSerie.class, this, ModelPackage.ACTOR__SERIEOGRAPHY);
		}
		return serieography;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<OtherFilm> getFilmography() {
		if (filmography == null) {
			filmography = new EObjectContainmentEList<OtherFilm>(OtherFilm.class, this, ModelPackage.ACTOR__FILMOGRAPHY);
		}
		return filmography;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<AssociationActorSerie> getActorSerie() {
		if (actorSerie == null) {
			actorSerie = new EObjectWithInverseResolvingEList<AssociationActorSerie>(AssociationActorSerie.class, this, ModelPackage.ACTOR__ACTOR_SERIE, ModelPackage.ASSOCIATION_ACTOR_SERIE__TARGET);
		}
		return actorSerie;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActorPackActor getActorPack() {
		if (actorPack != null && actorPack.eIsProxy()) {
			InternalEObject oldActorPack = (InternalEObject)actorPack;
			actorPack = (ActorPackActor)eResolveProxy(oldActorPack);
			if (actorPack != oldActorPack) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.ACTOR__ACTOR_PACK, oldActorPack, actorPack));
			}
		}
		return actorPack;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActorPackActor basicGetActorPack() {
		return actorPack;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setActorPack(ActorPackActor newActorPack) {
		ActorPackActor oldActorPack = actorPack;
		actorPack = newActorPack;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.ACTOR__ACTOR_PACK, oldActorPack, actorPack));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ModelPackage.ACTOR__ACTOR_SERIE:
				return ((InternalEList<InternalEObject>)(InternalEList<?>)getActorSerie()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ModelPackage.ACTOR__SERIEOGRAPHY:
				return ((InternalEList<?>)getSerieography()).basicRemove(otherEnd, msgs);
			case ModelPackage.ACTOR__FILMOGRAPHY:
				return ((InternalEList<?>)getFilmography()).basicRemove(otherEnd, msgs);
			case ModelPackage.ACTOR__ACTOR_SERIE:
				return ((InternalEList<?>)getActorSerie()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.ACTOR__SERIEOGRAPHY:
				return getSerieography();
			case ModelPackage.ACTOR__FILMOGRAPHY:
				return getFilmography();
			case ModelPackage.ACTOR__ACTOR_SERIE:
				return getActorSerie();
			case ModelPackage.ACTOR__ACTOR_PACK:
				if (resolve) return getActorPack();
				return basicGetActorPack();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.ACTOR__SERIEOGRAPHY:
				getSerieography().clear();
				getSerieography().addAll((Collection<? extends OtherSerie>)newValue);
				return;
			case ModelPackage.ACTOR__FILMOGRAPHY:
				getFilmography().clear();
				getFilmography().addAll((Collection<? extends OtherFilm>)newValue);
				return;
			case ModelPackage.ACTOR__ACTOR_SERIE:
				getActorSerie().clear();
				getActorSerie().addAll((Collection<? extends AssociationActorSerie>)newValue);
				return;
			case ModelPackage.ACTOR__ACTOR_PACK:
				setActorPack((ActorPackActor)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.ACTOR__SERIEOGRAPHY:
				getSerieography().clear();
				return;
			case ModelPackage.ACTOR__FILMOGRAPHY:
				getFilmography().clear();
				return;
			case ModelPackage.ACTOR__ACTOR_SERIE:
				getActorSerie().clear();
				return;
			case ModelPackage.ACTOR__ACTOR_PACK:
				setActorPack((ActorPackActor)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.ACTOR__SERIEOGRAPHY:
				return serieography != null && !serieography.isEmpty();
			case ModelPackage.ACTOR__FILMOGRAPHY:
				return filmography != null && !filmography.isEmpty();
			case ModelPackage.ACTOR__ACTOR_SERIE:
				return actorSerie != null && !actorSerie.isEmpty();
			case ModelPackage.ACTOR__ACTOR_PACK:
				return actorPack != null;
		}
		return super.eIsSet(featureID);
	}

} //ActorImpl
